#ifndef _THREAD_IMPL_H_
#define _THREAD_IMPL_H_

#include "tools/HandleWraper.h"
#include "tools/Thread_fwd.h"

#include <vector>


namespace sd
{
namespace tools
{
namespace thread
{
namespace impl
{


class ThreadImpl
{
public:
	ThreadImpl( int uid );
	ThreadImpl( const HHANDLE& handle );

	void kill();
	void suspend();
	void resume();
	void join();
	bool timed_join(int msec);

	bool isSuspended()const;
	bool isFinished()const;

	HHANDLE getHandle(){ return handle_; }

	int getId()const;
	const void* getCurrentEIP()const;


private:

	void CheckSuspendState();

	bool suspend_;
	HHANDLE handle_;
};

bool multi_join( thread::iterator begin, thread::iterator end, bool wait_all, int msec_time );

ThreadImpl* createThisThread();


}//impl
}//thread
}//tools
}//sd























#endif//_THREAD_IMPL_H_